package com.stus.dao.impl;

import com.stus.dao.MemberDao;
import com.stus.model.Member;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * Created by Alias on 2016/4/11.
 */
@Repository
public class MemberDaoImpl implements MemberDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Override
    public boolean insertMember(Member member) {
        String sql = "insert into member (account, username, password, phone, type, address) values(?,?,?,?,?,?)";
        Object obj[] = {member.getAccount(),member.getUsername(),member.getPassword(),member.getPhone(),member.getType(),member.getAddress()};
        int temp = jdbcTemplate.update(sql,obj);
        return temp > 0;
    }
}
